//
//  guestTimeCell.m
//  QRMaster
//
//  Created by myApple on 15/7/23.
//  Copyright (c) 2015年 myApple. All rights reserved.
//

#import "guestTimeCell.h"

@interface guestTimeCell()
{
    UIImageView * imageView;
    UILabel * roomNameLabel;
    UILabel * beginTimeLabel;
    UILabel * endTimeLabel;
}

@end

@implementation guestTimeCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self prepareView];
    }
    return self;
}

-(void)prepareView
{
    float x = 16;
    float y = 10;
    float width = 38;
    float height = 38;
    imageView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    imageView.image = [UIImage imageNamed:@"assignTimeImage"];
    [self.contentView addSubview:imageView];
    
    x = 72;
    width = UI_SCREEN_WIDTH - x;
    height = 20;
    roomNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    roomNameLabel.font = [UIFont systemFontOfSize:16.0];
    [self.contentView addSubview:roomNameLabel];
    
    y += height + 5;
    height = 15;
    width = 98;
    beginTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    beginTimeLabel.font = [UIFont systemFontOfSize:11.0];
    beginTimeLabel.textColor = UIColorFromRGB(0x727272);
    [self.contentView addSubview:beginTimeLabel];
    
    
    x += width;
    width = 110;
    endTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    endTimeLabel.font = [UIFont systemFontOfSize:11.0];
    endTimeLabel.textColor = UIColorFromRGB(0x727272);
    [self.contentView addSubview:endTimeLabel];
}

-(void)setBuildId:(NSString *)buildId
{
    _buildId = buildId;
}

-(void)setBuildName:(NSString *)buildName
{
    _buildName = buildName;
}

-(void)setFloorId:(NSString *)floorId
{
    _floorId = floorId;
}

-(void)setFloorName:(NSString *)floorName
{
    _floorName = floorName;
}

-(void)setRoomId:(NSString *)roomId
{
    _roomId = roomId;
}

-(void)setRoomName:(NSString *)roomName
{
    _roomName = roomName;
    roomNameLabel.text = [NSString stringWithFormat:@"%@%@%@",_buildName,_floorName,_roomName];
}

-(void)setBeginTime:(NSString *)beginTime
{
    _beginTime = beginTime;
    beginTimeLabel.text = beginTime;
}

-(void)setEndTime:(NSString *)endTime
{
    _endTime = endTime;
    if ([endTime isEqualToString:@""]) {
        endTimeLabel.text = [NSString stringWithFormat:@"~ %@",NSLocalizedString(@"forever", nil)];
        return;
    }
    endTimeLabel.text = [NSString stringWithFormat:@"~ %@",endTime];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
